<?php  
header("Content-type: text/html; charset=utf-8");   
//保存从微信得到的code  
$code = "";  
//获得菜单中设置的state值  
$state = "";  
if (isset($_GET['code']) && isset($_GET['state']) ){  
    $code = $_GET['code'];  
    $state = $_GET['state']; 
	$pos1 = strpos($state,'actiontoken');
	$st = substr($state,0,$pos1);
	 
	$state2 = substr($state,$pos1+11);
	$pos2 = strpos($state2,'pid');
	$token = substr($state2,0,$pos2);
	$pid  = substr($state2,$pos2+3);
	
	header("Location:http://".$_SERVER['HTTP_HOST']."/index.php?g=Wap&m=Expert&a=auth&action=".$st."&code=".$code."&token=".$token."&id=".$pid);
	
}else{  
    echo "oauth认证出错！";  
    return ;  
}  
  
?>  

